<template>
    <view class="content">
        <view class="item" v-for="(item,index) in list" :key='index'>
            <view class="u-flex u-row-between">
				<view class="sub">{{item.name}}</view>
				<view class="title">{{item.time}}</view>
			</view>
			<view v-if="item.address">{{item.address}}</view>
        </view>
        <!-- <view class="none" v-if="list.length == 0">暂无相关信息</view> -->
        <view style="height: 94rpx;padding-top: 30rpx;">
            <u-loadmore :status="status" v-if="status != 'loadmore'" />
        </view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                status: 'loadmore', //是否显示没有更多了
                page: 1,
                list: [], 
            }
        },
        onLoad() {
            this.getList()
        },
        onReachBottom() {
        	if(this.page == 1){return}
        	this.getList()
        },
        methods: {
            // 获取列表
            getList() {
            	if (this.status == 'nomore') return;
            	this.status = 'loading';
            	this.$ajax('user_clockin_detail', {
            		user_token: this.$getSync('userToken'),
            		page: this.page,
            		limit: 10,
            	}).then(ret => {
            		if (ret.success == 1000) {
            			if (ret.detail && ret.detail.clockin && ret.detail.clockin.length > 0) {
            				this.list = this.list.concat(ret.detail.clockin);
            				this.page++;
            				this.status = 'loadmore'
            			} else {
            				this.status = 'nomore'
            			}
            		} else {
            			this.$toast(ret.msg);
            		}
            	});
            },
        },
    }
</script>

<style lang="scss">
    .none{
    	text-align: center;
    	padding: 50upx 0;
    	box-sizing: border-box;
    	color: #999;
    	font-size: 24upx;
    }
    page {
        background: #f5f5f5;
    }
    .content{
        padding: 20rpx;
    }
    .item{
        background-color: #fff;
        border-radius: 20rpx;
        padding: 30rpx 25rpx;
        margin-bottom: 20rpx;
    }
    .title{
        font-size: 30rpx;
        font-weight: bold;
    }
    .sub{
        font-size: 24rpx;
        color: #444;
    }
    
    
</style>

